

part of appcommon;

class BottomNavigationItem extends StatelessWidget {
  const BottomNavigationItem({this.title, this.icon, this.padding, this.onTap,
    this.margin = 0, this.txtStyle, this.mark, this.alignment}):
        assert(icon != null, "icon data can not be null or empty"), assert(title != null, "title can not be null or empty");
  final EdgeInsetsGeometry? padding;

  /// 选中样式
  final TextStyle? txtStyle;
  final double margin;

  /// 图片
  final Widget? icon;
  final void Function()? onTap;
  final String? title;
  final Widget? mark;
  final MainAxisAlignment? alignment;

  @override
  Widget build(BuildContext context) {
    // TODO: implement build

    return Expanded(
        flex: 1,
        child: GestureDetector(
            onTap: onTap,
            child: Container(
                color: Colors.transparent,
                child: Padding(
                    padding: padding ?? EdgeInsets.zero,
                    child: Stack(
                      alignment: Alignment.center,
                      children: <Widget>[
                        Container(
                          color: Colors.white,
                          child: Column(
                            mainAxisSize: MainAxisSize.min,
                            // mainAxisAlignment: alignment ?? MainAxisAlignment.center,
                            children: <Widget>[
                              icon ?? const SizedBox(),
                              SizedBox(height: margin),
                              Text(
                                title ?? "",
                                style: txtStyle,
                              )
                            ],
                          )),
                        mark?? const SizedBox()
                      ],
                    )))));
  }
}
